home *** CD-ROM | disk | FTP | other *** search
/ PC Format Collection 13 / PCFORMAT.bin / demo.dir / 00043_Script_Button down handler < prev    next >
Text File  |  1995-03-06  |  3KB  |  96 lines

  1. The following is a general-purpose handler to simulate a common button behavior.
  2.  
  3.  
  4.  We assume that each button has three pieces of artwork associated with it, in three successive castmember slots: first is the default button, then the hilit (rollover) button, then the clicked 
  5. (depressed) button. The Handler can be called from a Frame Script, with a different action associated with each sprite. These actions are scripted as a single string. Example Frame Script:
  6.  
  7.  
  8.  
  9. >>   if rollover(1) then FlashRoller 1, "go to frame 10"
  10.  
  11. >>   if rollover(2) then FlashRoller 2, "play movie " "E& "My Drive:More Movies:NewMovie" 
  12. "E
  13.  
  14. >>   if rollover(4) then FlashRoller 4, "set the stageColor to random(256)" &RETURN& 
  15. "updateStage" &RETURN& "MySpecialHandler"
  16.  
  17. >>   go the frame
  18.  
  19.  
  20.  The handler itself, defined in the Movie Script, has extensive testing for rolloffs and mouseups:
  21.  
  22.  
  23.  
  24. >>   on FlashRoller whichChannel, scriptToExecute
  25.  
  26. >>       set myCast = the mouseCast  
  27.  
  28. >>       set flag = 0  
  29.  
  30. >>       set the castNum of sprite whichChannel = myCast + 1
  31.  
  32. >>       updateStage
  33.  
  34. >>        repeat while rollover(whichChannel)
  35.  
  36. >>           if the mouseDown then 
  37.  
  38. >>               set the castNum of sprite whichChannel = myCast + 2
  39.  
  40. >>               updateStage      
  41.  
  42. >>               repeat while the mouseDown
  43.  
  44. >>                    if not rollover(whichChannel) then exit repeat
  45.  
  46. >>               end repeat      
  47.  
  48. >>               if rollover(whichChannel) then set flag = 1
  49.  
  50. >>              exit repeat      
  51.  
  52. >>           end if      
  53.  
  54. >>       end repeat
  55.  
  56. >>       set the castNum of sprite whichChannel = myCast
  57.  
  58. >>       updateStage
  59.  
  60. >>       if flag then do scriptToExecute  
  61.  
  62. >>   end FlashRoller
  63.  
  64.  
  65. --A number of people have asked me
  66. --by Email how to make a QT movie
  67. --run like a demon in MacDirector 4.
  68. --The following can be gleaned from
  69. --Director 4 Tips & Tricks, p.16
  70. --
  71. -- * Try this LINGO for playing a QT movie in channel 1 *
  72. --
  73. --on exitFrame
  74. --   global gMoovLength
  75. --   set gMoovLength=the duration of cast (the castNum of sprite 1)
  76. --end
  77. --
  78. --* :in the following frame:*
  79. --
  80. --on exitFrame
  81. --   repeat while the movieRate of
  82. --   sprite 1
  83. --        updateStage
  84. --   end repeat
  85. --end
  86. --
  87. -- * be sure and set the movie to play
  88. --Direct to Stage, play every frame,
  89. -- in the Cast Movie radio button if
  90. --no QT sound is used*
  91. --You can still play a looped sound in
  92. --one of the sound channels, or use a puppetSound.
  93. --Make a projector, and be sure to give it enough RAM in the get info
  94. --to load the QT movie.
  95. --This really works!
  96.